<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" 
           uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我的商城</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath }/html/css/style.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath }/html/css/login.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath }/html/css/invest.css">
	<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
	</script>
	<style>
		.select {
				  width:auto; margin-top:12px; 
			      font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
			      font-size:11px; 
			      color:#999999;
			      line-height:25px;
			      letter-spacing:1px

			}
	</style>
</head>
<body>
  <div class="wrap" style="background-color:#f7f7f7;">

    <div class="header">
     <div class="top">
      <ul id="nav">
        <li><a><span>首页</span></a></li>
        <li><a href="${pageContext.request.contextPath }/user/car"><span>我的购物车</span></a></li>
        <li><a href="${pageContext.request.contextPath }/user/toMyOrder"><span>我的订单</span></a></li>
        <li><a href="${pageContext.request.contextPath }/user/logout"><span>登出</span></a></li>
      </ul>
      <div class="investCont" style="width:200px;height:100px;position:absolute;left:1138px">
	      <c:if test="${pic!=null }">
		      <ul id="login">
		         <li> <img src="/pic/${pic}" id="line" width="100px" height="100px" style="position:absolute;right:-11px;top:0px"/></li>
		      </ul>
	      </c:if>
		   <form method="post" action="${pageContext.request.contextPath }/user/pic" enctype="multipart/form-data" name="fileUploadForm" id="fileUploadForm" style="width:200px;height:100px">
		　　　　<input type="file" name="docFile" id="docFile" style="display:none;"/>
				   <!-- <input type="file" name="docFile" id="docFile" style="display: none;" onchange="document.fileUploadForm.filePath.value=this.value"/>
		　　　　	   <input type="text" name="filePath" id="filePath" style="display: none;"/>  -->
			  <div style="position:absolute;right:38px;top:0px">
				  <button  style="width:75px;height:20px" class="btn1" type="button" onclick="document.fileUploadForm.docFile.click()">更改头像</button><br/>
				  <button  style="width:75px;height:20px" class="btn1" type="button" onclick="mysubmit()">确认修改</button>　　
		　　	  </div>
			</form>
	  </div>  
    </div><!--top-->
    </div><!--header-->

    <div class="main">
        <div class="withdraw">
            <h3 style="float:left">商品列表 <span></span> 
            </h3>
            <form action="${pageContext.request.contextPath }/goods/consumeselectbycol" 
            	  method="post" style="width:1000px;position:absolute;top:245px;left:268px;">
	            <label class="select">商品类型:</label><input class="selectinput"  type="text" name="type.typename" />
	            <label class="select">商品状态:</label><input class="selectinput"  type="text" name="goods.status" />
	            <label class="select">商品名字:</label><input class="selectinput"  type="text" name="goods.name"/>
	            <input type="submit" value="查询"/>
			</form>
            
            
        </div>
        <div class="invest" style="clear:both;">
            <ul id="investTitle">
          <c:if test="${enhanceList!=null}"> 
          <c:forEach items="${enhanceList}" var="enhance">
                <li>
                    <p class="dkmc" style="font-size:25px">${enhance.goods.name}</p>
                    <div class="investCont">
                        <div style="width: 160px">
                            <p class="lilv">${enhance.discountsMessage.describe}</p>
                            <p class="investTit">商品优惠信息</p>
                        </div>
                        <div  style="width: 160px">
                            <p class="lilv" style="color: #858585">${enhance.goods.price}<span>元</span></p>
                            <p class="investTit">商品价格</p>
                        </div>
                        <div  style="width: 160px">
                            <p class="lilv" style="color: #858585">${enhance.type.typename}</p>
                            <p class="investTit">商品类别</p>
                        </div>
                        <div  style="width: 160px">
                            <p class="lilv" style="color: #858585"><fmt:formatDate value="${enhance.goods.prodate}" pattern="yyyy-MM-dd"/></p>
                            <p class="investTit">生产日期</p>
                        </div>
                        <c:if test="${enhance.goods.effdate!=null&&enhance.goods.effdate!=''}">
	                        <div  style="width: 160px">
	                            <p class="lilv" style="color: #858585"><fmt:formatDate value="${enhance.goods.effdate}" pattern="yyyy-MM-dd"/></p>
	                            <p class="investTit">有效期</p>
	                        </div>
                        </c:if>
                        <c:if test="${enhance.goods.producer!=null&&enhance.goods.producer!=''}">
	                        <div  style="width: 160px">
	                            <p class="lilv" style="color: #858585">${enhance.goods.producer}</p>
	                            <p class="investTit">生产商</p>
	                        </div>
                        </c:if>
                        <c:if test="${enhance.goods.publisher!=null&&enhance.goods.publisher!=''}">
	                        <div  style="width: 160px">
	                            <p class="lilv" style="color: #858585">${enhance.goods.publisher}</p>
	                            <p class="investTit">出版社</p>
	                        </div>
                        </c:if>
                        <c:if test="${enhance.goods.size!=null&&enhance.goods.size!=''}">
	                        <div  style="width: 160px">
	                            <p class="lilv" style="color: #858585">${enhance.goods.size}</p>
	                            <p class="investTit">尺码</p>
	                        </div>
                        </c:if>
                        <div  style="width: 160px">
                            <p class="lilv" style="color: #858585">${enhance.goods.outdate}</p>
                            <p class="investTit">下架日期</p>
                        </div>
                        <div  style="width: 160px">
                            <p class="lilv" style="color: #858585">${enhance.goods.status}</p>
                            <p class="investTit">商品状态</p>
                        </div> 
                        <div style="float:right">
                            <button class="btn1" onclick="insertCar(${enhance.goods.id})">加入购物车</button>
                        </div>
                    </div>
                </li>
             </c:forEach> 
             </c:if> 
            </ul>
            <div class="fy">
                <ul class="fyList">
                    <li><a href=""> > </a></li>
                    <li><a href="">1</a></li>
                    <li><a href="">2</a></li>
                    <li><a href="">3</a></li>
                    <li><a href="">4</a></li>
                    <li><a href="">5</a></li>
                    <li><a href="">6</a></li>
                    <li><a href="">7</a></li>
                    <li><a href="">8</a></li>
                    <li><a href="">9</a></li>
                    <li><a href="">10</a></li>
                    <li><a href=""> < </a></li>
                    <li style="width: 65px"><a href=""> 10条／页 </a></li>
                    <li style="border: none"><a>跳至</a></li>
                    <li style="width: 46px;"><input style="width: 43px;border: none;" type="text"></li>
                    <li style="border: none"><a>页</a></li>
                </ul>
            </div>
        </div>
    </div><!--main-->
</div><!--wrap-->
<script>
	
	function insertCar(id)
	{	
		var num=$.trim(prompt("请输入商品数量"));
		if(num==''||num==null)
		{
			alert("加入购物车失败,需要输入商品数量");
			return;
		}
		$.ajax({
			url:"${pageContext.request.contextPath }/user/insertCar?goodsnum="+num+"&goodsid="+id,
			async:true,
			success:function()
			{
				alert("商品成功加入购物车");
			}
		});
		
	}
	function mysubmit(){
		if($("#docFile").val()==null||$("#docFile").val()=="")
		{
			alert("请先选择新的头像");
			return;
		}
		$("#fileUploadForm")[0].submit();
	}
	
</script>
</body>
</html>
